package cn.com.sbell.vss.csg.vap;

import org.dom4j.Element;

import cn.com.sbell.vss.VssConstants;
import cn.com.sbell.vss.VssException;
import cn.com.sbell.vss.csg.vap.bean.IPCameraInfo;
import cn.com.sbell.vss.csg.vsclient.VsClient;
import cn.com.sbell.vss.csg.vsclient.util.BeanValidator;
import cn.com.sbell.vss.csg.vsclient.util.PropertiesHolder;

public class SetIpCameraInfo extends ProtectedVsCommander {

	protected Element executeCommand(VsClient vsClient,
			PropertiesHolder holder, Element root) {
		IPCameraInfo ipCameraInfo = (IPCameraInfo) holder
				.populate(new IPCameraInfo());
		BeanValidator.validateNotNull(ipCameraInfo, new String[] {
				"whiteBalance", "powerFreq", "panRM", "panRP", "panHome",
				"tiltRM", "tiltRP", "tiltHome", "ledPower", "outputStatus",
				"enableNightView", "setupType" });
		if (!vsClient.setIPCameraInfo(ipCameraInfo)) {
			throw new VssException(VssConstants.CODE_SET_IPCAMERAINFO_FAILED);
		}
		return root;
	}

}
